package Exercise;

public class Exercise5 {
    public static void main(String[] args)
    {
        S s=new S();
        s.addAll(new int[]{1,2,3});
        System.out.println(s.getSum());
    }
    
}
class F
{
    private static final int MAX_NUM=1000;
    private int[] arr=new int[MAX_NUM];
    private int count;
    public void add(int number)
    {
        if(count<MAX_NUM)
        {
            arr[count++]=number;
        }
    }
    public void addAll(int[] numbers)
    {
        for(int num:numbers)
        {
            add(num);
        }
    }

}
class S extends F
{
    private long sum;
    @Override
    public void add(int number){
        super.add(number);
        sum+=number;
    }
    @Override
    public void addAll(int []numbers)
    {
        super.addAll(numbers);
    }
    public long getSum()
    {
        return sum;
    }
    
}